package com.offcn.service.impl;

import com.offcn.mapper.ClientsMapper;
import com.offcn.mapper.MemberClientsMapper;
import com.offcn.mapper.MemberMapper;
import com.offcn.mapper.RoleMemberMapper;
import com.offcn.pojo.*;
import com.offcn.service.ClientsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientsServiceImpl implements ClientsService {

    @Autowired
    RoleMemberMapper roleMemberMapper;

    @Autowired
    ClientsMapper clientsMapper;

    @Autowired
    MemberMapper memberMapper;

    @Autowired
    MemberClientsMapper memberClientsMapper;



    @Override
    public List<Clients> getList(Member memberSession) {


        RoleMemberExample exp1 = new RoleMemberExample();
        RoleMemberExample.Criteria criteria = exp1.createCriteria();
        criteria.andMemberidEqualTo(memberSession.getMid());
        List<RoleMember> roleMembers = roleMemberMapper.selectByExample(exp1);
        Long roleid = roleMembers.get(0).getRoleid();


        if(roleid==1L){//经理

            ClientsExample exp2 = new ClientsExample();
            List<Clients> clientsList = clientsMapper.selectByExample(exp2);
            return  clientsList;
        }
        if(roleid==2L){




        }
        if(roleid==3L){

        }
        return null;
    }
}
